package com.otheima.arraystest;

import java.sql.SQLOutput;
import java.util.Arrays;

public class Test {//arrays的三个方法
    public static void main(String[] args) {
        int[] arr = {10, 50, 99, 8, 7, 5, 2, 1};
        System.out.println("排序前的数组");
        System.out.println(Arrays.toString(arr));
        //排序
        Arrays.sort(arr);
        //二分查找
        System.out.println("查找元素99的索引");
        System.out.println(Arrays.binarySearch(arr,99));
        //将数组转为字符串
        System.out.println("排序后的数组");
        System.out.println(Arrays.toString(arr));
    }
}
